package severlet;

import dao.GuaranteeDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "AdminGuaranteeDeleServlet", value = "/AdminGuaranteeDeleServlet")
public class AdminGuaranteeDeleServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        String dormitoryid = request.getParameter("dormitoryid");
        String studentname = request.getParameter("studentname");
//        String dormitoryid = (String) request.getSession().getAttribute("dormitoryid");
//        String studentname = (String) request.getSession().getAttribute("studentname");
//        request.getSession().getAttribute()
//        String button = request.getParameter("button");
//if (button.equals("删除")){

    //dao
    GuaranteeDao guaranteeDao=new GuaranteeDao();
    guaranteeDao.DeleInfoByDormidAndStuname(dormitoryid,studentname);
    //返回
    request.getRequestDispatcher("/AdminGuaranteeServlet").forward(request,response);
//}


    }
}
